<!--
 * @Author: 灰灰
 * @Date: 2022-01-10 15:04:12
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-01-11 10:42:15
 * @Description: 
-->

<template>
  <page-box ref="pageBoxRef"
            :tableCols="cols"
            :custom="true"
            :data="dataList"
            :total="tTotal"
            :formList="formList"
            :formData="queryParams"
            :tableLoading="loading"
            @resetCb="customReset"
            @searchCb="searchCb"
            @pagingChangeCb="pagingChange">
    <template v-slot:tableCol>
      <el-table-column width="80"
                       label="操作"></el-table-column>
    </template>

  </page-box>
</template>

<script>
import { getList } from '@/api/table'
import paging from '@/mixins/paging';

export default {
  mixins: [paging],
  data () {
    return {
      getList,
      initLoad: false,
      cols: [{ prop: 'year', label: '年' }],
      formList: [{
        label: '名称',
        prop: 'name',
        placeholder: '名称'
      }]
    }
  },
  mounted () {
    this.loadData();
  },
  methods: {
    searchCb () {
      this.loadData();
    },
    loadData () {
      this.loading = true;
      console.log('-----query')
      getList(this.queryParams).then(res => {
        const data = res.data.items;
        this.tTotal = res.data.total;
        this.dataList = data || [];
      }).finally(() => {
        this.loading = false
      })
    }
  }
}
</script>

<style>
</style>